home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr47
/
qfml10.zip
/
EXAMPLE1.CPP
next >
Wrap
C/C++ Source or Header
|
1995-01-27
|
2KB
|
91 lines
/*********************************************************************
** QFML DEMO :
** ALTHOUGH THIS LISTING CAN'T BE MODIFIED, IT SHOWS HOW QFM WORKS.
** II JUST SHOWS HOW TO USE SOME POKE'S AND PEEK'S.
** A VERY SIMPLE EXAMPLE OF QFM.
**
** THIS WAS COMPILED USING A BORLANDC(3.1) PROJECT, TRANSLATED INTO A MAKE
** WITH BORLAND'S PRJ2MAK AND ADDING /3 TO TLINK LINE IN THE MAKE.
** (C) RENDER OF ACC TEAM (1995)
*********************************************************************/
#include "qfml.h"
#include <stdio.h>
#include <stdlib.h>
#define dword unsigned long int
//============================================================
// Look carefully at this one, this is the IMPORTANT BIT.
void
main(void)
{
dword First_addr; // Keeps starting QFM's memory address
dword MCGA_off; // Plane address of video mem.
dword num_ks; // Keeps the amount of K's reserved
// First of all start QFM before leaving textmode
if (StartPL()) exit(1);
// Then open the whole mem after the first Megabyte.
if (OpenMem()) {
LeavePL(); // Leave QFM mode before leaving your code.(ALWAYS)
exit(1);
}
// We get the amount of memory available
num_ks=GiveAmo();
if (num_ks<1) { // We need a minimum of 1 k
CloseMem(); // Close mem. before leavinf QFM. (ALWAYS)
LeavePL(); // Leave QFM mode before leaving your code.(ALWAYS)
}
printf ("Available memory after first Mgb. (Kbytes):%lu\n",num_ks);
// Then we need the starting address of this block in plane
// memory. Observe it will always be after position 1048576 (1Mb)
First_addr=GiveSta();
// First Poke data and then peek it to check it
Pokeb(First_addr+10,101);
printf ("Peekb(%lu)=%d\n",First_addr+10,Peekb(First_addr+10));
Pokew(First_addr+10,0xFFFF);
printf ("Peekw(%lu)=%u\n",First_addr+10,Peekw(First_addr+10));
Pokedw(First_addr+10,0x00010001);
printf ("Peekdw(%lu)=%lu\n",First_addr+10,Peekdw(First_addr+10));
// Close openned mem. before living
CloseMem();
// Leave QFM before termination
LeavePL();
}